export const eventBus = new EventTarget()

export function on(eventName, handler) {
  eventBus.addEventListener(eventName, handler)
}

export function off(eventName, handler) {
  eventBus.removeEventListener(eventName, handler)
}

export function emit(eventName, detail) {
  eventBus.dispatchEvent(new CustomEvent(eventName, { detail }))
} 